import http from './http.js'


//封装请求各种歌曲接口的函数
function getSongList(type, size = 6) {
    const url = `/api/v1/restserver/ting?method=baidu.ting.billboard.billList&type=${type}&size=${size}`
    return http.get(url)

}

//封装请求歌曲详情接口的函数

function getMusicDetail(songid) {
    const url = `/api/v1/restserver/ting?method=baidu.ting.song.play&songid=${songid}`
    return http.get(url)
}


//封装歌手接口函数
function getSinger(tinguid) {
    const url = `/api/v1/restserver/ting?method=baidu.ting.artist.getInfo&tinguid=${tinguid}`
    return http.get(url)
}

// 获取歌手的歌曲
function getSingerDetail(tinguid, limits) {
    const url = `/api/v1/restserver/ting?method=baidu.ting.artist.getSongList&tinguid=${tinguid}&limits=${limits}`
    return http.get(url)
}
// 封装搜索接口
function getSearch(keyWords) {
    // http: //tingapi.ting.baidu.com/v1/restserver/ting?method=baidu.ting.search.catalogSug&query=l
    const url = `api/v1/restserver/ting?method=baidu.ting.search.catalogSug&query=${keyWords}`
    return http.get(url)
}
export {
    getSongList,
    getMusicDetail,
    getSinger,
    getSingerDetail,
    getSearch
};